Skip to content

Fit the Node heap to the 1Gi pod limit - #8

Merged
lolgab merged 1 commit into
masterfrom
oxlint-node-heap
Dec 3, 2026
Merged

lolgab merged 1 commit into
masterfrom
oxlint-node-heap

Conversation

@lolgab

@lolgab lolgab commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

entrypoint.sh lets the Node wrapper grow its old space to 4608 MiB, with 128 MiB semi-spaces on top (V8 sizes the young generation at 3× the semi-space, so up to 384 MiB), in a pod with a 1Gi memory limit that also has to fit the oxlint process. V8 sees no memory pressure until far past the limit, so the kernel kills the pod first.

Flag Before After
--max-old-space-size 4608 512
--max-semi-space-size 128 16

The wrapper's largest allocation is oxlint's JSON output: spawnSync buffers up to 100 MB (maxBuffer), then it is turned into a string and parsed. Locally (Node, a synthetic 100 MB oxlint JSON with 250k diagnostics run through the same spawnSync + JSON.parse + emit loop):

Flags Peak RSS Time
4608 / 128 (before) 608 MiB 1.6 s
512 / 16 (after) 396 MiB 2.2 s
256 / 16 392 MiB 2.4 s

So 512 MiB covers the worst output the wrapper accepts with about 2× headroom over the live heap, and leaves the rest of the 1Gi for oxlint while it runs (about 210 MiB RSS single-threaded on TypeScript's lib/*.js). If the heap still runs out, Node fails with a heap error instead of the pod being OOM-killed.

Related: #7 (oxlint --threads 1).

  • Build the image and run the multiple-tests suite (CircleCI plugins_test)
  • After deploy, 7 days: oxlint ToolOutOfMemory count vs before
  • After deploy, 7 days: p99 run time and timeouts vs before (smaller young generation means more scavenges)

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@lolgab
lolgab marked this pull request as ready for review December 3, 2026 10:52
@lolgab
lolgab enabled auto-merge (squash) December 3, 2026 10:52

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

✅ No blocking issues noticed

No blocking findings were identified.

Test suggestions

  • Verify the entrypoint invokes Node with the reduced old-space and semi-space flags.
  • Run the wrapper against large oxlint JSON output and verify it completes without exceeding the pod memory budget.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify the entrypoint invokes Node with the reduced old-space and semi-space flags.
2. Run the wrapper against large oxlint JSON output and verify it completes without exceeding the pod memory budget.

TIP Add review instructions in .codacy/instructions/review.md, or an AGENTS.md, so the reviewer knows your conventions.
TIP How was this review? Give us feedback

@lolgab
lolgab merged commit d15f9c5 into master Dec 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants